home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl70b2.lha / tcl7.0b2 / doc / return.n < prev    next >
Text File  |  1993-07-16  |  3KB  |  84 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/return.n,v 1.5 93/07/16 16:31:07 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS return tcl 7.0
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. return \- Return from a procedure
  29. .SH SYNOPSIS
  30. \fBreturn \fR?\fB\-code \fIcode\fR? ?\fIstring\fR?
  31. .BE
  32.  
  33. .SH DESCRIPTION
  34. .PP
  35. Return immediately from the current procedure
  36. (or top-level command or \fBsource\fR command),
  37. with \fIstring\fR as the return value.  If \fIstring\fR is not specified then
  38. an empty string will be returned as result.
  39. .PP
  40. In the usual case where the \fB\-code\fR option isn't
  41. .VS
  42. specified the procedure will return normally (its completion
  43. code will be TCL_OK).
  44. However, the \fB\-code\fR option may be used to cause the
  45. procedure to return with an exceptional completion code,
  46. which will generate an exception in the script that invoked the procedure.
  47. \fICode\fR may have any of the following values:
  48. .TP 10
  49. \fBok\fR
  50. Normal return:  same as if the option is omitted.
  51. .TP 10
  52. \fBerror\fR
  53. Error return: same as if the \fBerror\fR command were used to
  54. terminate the procedure.
  55. .TP 10
  56. \fBreturn\fR
  57. The current procedure will return with a completion code of
  58. TCL_RETURN, so that the procedure that invoked it will return
  59. also.
  60. .TP 10
  61. \fBbreak\fR
  62. The current procedure will return with a completion code of
  63. TCL_BREAK, which will terminate the innermost nested loop in
  64. the code that invoked the current procedure.
  65. .TP 10
  66. \fBcontinue\fR
  67. The current procedure will return with a completion code of
  68. TCL_CONTINUE, which will terminate the current iteration of
  69. the innermost nested loop in the code that invoked the current
  70. procedure.
  71. .TP 10
  72. \fIvalue\fR
  73. \fIValue\fR must be an integer;  it will be returned as the
  74. completion code for the current procedure.
  75. .LP
  76. The \fB\-code\fR option is rarely used.
  77. It is provided so that procedures that implement
  78. new control structures can reflect exceptional conditions back to
  79. their callers.
  80. .VE
  81.  
  82. .SH KEYWORDS
  83. break, continue, error, procedure, return
  84.